package org.example.erpapicommon.Util;

public enum ResponseType {
    OK(200, "请求成功"),
    BAD_REQUEST(400, "参数错误"),
    UNAUTHORIZED(401, "未授权"),
    NOT_FOUND(404, "请求资源未找到"),
    FORBIDDEN(403, "禁止访问"),
    BAD_METHOD(405, "请求方法不正确"),
    INTERNAL_ERROR(500, "系统出错");

    private final int code;
    private String message;

    private ResponseType(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int code() {
        return this.code;
    }

    public String message() {
        return this.message;
    }

    public static ResponseType fromCode(int code) {
        ResponseType[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            ResponseType value = var1[var3];
            if (value.code == code) {
                return value;
            }
        }

        return INTERNAL_ERROR;
    }
}
